/**
* 虚拟展厅
* Author: Feil.Wang
* Date: 2013.04 
*/

$(function(){

	
});



/**
 * 全选|反选
 * @param	{String}	全选checkbox id
 * @param	{String}	子checkbox name
 */
function batchSelect(id,name){
	$("#"+id+",input[name='"+name+"']").attr("checked",false);
	var $subBox = $("input[name='"+name+"']");
	var $targBox = $("#"+id);
	$targBox.click(function(){
		$subBox.attr("checked",this.checked);
	});
	$subBox.click(function(){
		$targBox.attr("checked",$subBox.length == $("input[name='"+name+"']:checked").length ? true : false);
	});
}
function txtAllSelect(){
	$(".table-list").find("input:checkbox").attr("checked",true);
}
function txtInvertSelect(){
	$(".table-list").find("input:checkbox").attr("checked",false);
}
/**
 * 自定义select
 * @param	{String}	目标id
 * @param	{String}	方向"up","down"分别表示向上或向下弹出
 */
 function customSelect(id,pos){
	var $targ = $("#"+id);
	var $option = $targ.siblings("ul");
	$targ.click(function(event){
		event.stopPropagation();
		if($option.css("display")=="none"){
			$option.addClass(pos).slideDown(400);
		}else{
			$option.slideUp(400);
		}
	});
	$option.find("li").click(function(){
		var txt = $(this).text();
		$targ.children(".left").text(txt);
		$option.slideUp(400);
		$.dialog.alert('已选择“'+txt+'”');
	});
	$(document).bind("click",function(e){
		var target  = $(e.target);
		if(target.closest(".slt-option").length == 0){
			$(".slt-option").slideUp(400);
		}
	})
}

/**表单检测提示窗*/
function formCheck(msg,obj){
	$.dialog.alert(msg,function(){
		obj.focus();
	});
}









